﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Aquasoft.Iszr.Proxy.WebServices.Constants
{
    public abstract class ConstItem<T> where T:ConstItem<T>
    {
        public string Nazev { get; set; }
        public int Kod { get; set; }

        static ConstItem()
        {
            All = new List<T>();            
        }
        public static List<T> All { get; private set; }

        /// <summary>
        /// vrati ciselnikovou polozku podle kodu
        /// </summary>
        /// <param name="kod"></param>
        /// <returns>null pokud nebyla nalezena</returns>
        public static T FindByKod(int kod)
        {
            return All.FirstOrDefault(p => p.Kod == kod);
        }

    }
}
